{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "90c2c1d5-ff9a-4051-8786-ba78a6a88476",
   "metadata": {},
   "outputs": [],
   "source": [
    "import fitz  # PyMuPDF\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import os\n",
    "import tabula\n",
    "import re"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "887d51be-93e0-47a3-9722-a5097cfa0270",
   "metadata": {},
   "source": [
    "# 任务1.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "45445ace-d110-4387-8933-29bc6b1c0615",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 读取PDF文件\n",
    "def read_pdf(file_path):\n",
    "    doc = fitz.open(file_path)\n",
    "    text = \"\"\n",
    "    for page in doc:\n",
    "        text += page.get_text()\n",
    "    doc.close()\n",
    "    return text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2128d194-f7f4-4646-80d8-c6a9597fe1f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "all_text=[] #汇总所有文本，方便后面随时使用\n",
    "name=[] #记录注册证号\n",
    "folder_path = r\"C:\\Users\\柔莹\\Desktop\\泰迪杯数据分析\\B题\\数据\\特医食品说明书\"\n",
    "for filename in os.listdir(folder_path):\n",
    "    if filename.endswith(\".pdf\"): #读取所有文件\n",
    "        file_path = os.path.join(folder_path, filename)\n",
    "        text=read_pdf(file_path)\n",
    "        name.append(filename)\n",
    "        all_text.append(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4b8d3cb5-1c92-4bf8-9a9b-49677e66bcf4",
   "metadata": {},
   "outputs": [],
   "source": [
    "#分类，因为pdf内的表格不统一\n",
    "col=[]\n",
    "for text in all_text:\n",
    "    a=text.find('【营养成分表】')\n",
    "    b=text.find('每100kJ')\n",
    "    t=text[a:b+6]  #表头\n",
    "    col.append(t.count('\\n')) #记录表头分隔后的个数，即列数\n",
    "col=np.array(col)-1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "99e3b2fc-a0aa-4eea-86b2-6f6d964b16c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "#提取数据\n",
    "all_data=[]\n",
    "for i in range(len(all_text)):\n",
    "    if col[i]==2:\n",
    "        pattern = r\"([\\w()（）]+)\\s+(\\d+\\.?\\d*)\\s+(\\d+\\.?\\d*)\" # 使用正则表达式提取符合表格格式的字符串\n",
    "    else:\n",
    "        pattern = r\"\\b(\\w+\\s*\\(.+?\\))?\\s*([\\d\\.]+)\\s+([\\d\\.]+)\\s+([\\d\\.]+)\"\n",
    "    matches = re.findall(pattern, all_text[i]) \n",
    "    data=[]\n",
    "    for match in matches:\n",
    "        data.append([match[0],match[col[i]],name[i][:-4]]) #提取需要的数据\n",
    "    data=pd.DataFrame(data,columns=['营养成分','每100kJ','注册证号'])\n",
    "    all_data.append(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "64a99488-8840-4e9b-bd6d-9798f8562ffe",
   "metadata": {},
   "outputs": [],
   "source": [
    "cols=['能量(kJ)','脂肪(g)','碳水化合物(g)','蛋白质(g)','钠(g)','氯(mg)','钾(mg)','磷(mg)'] #正确排序的列名"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "07e38af1-f811-4297-8357-f134d1822baf",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.concat(all_data,ignore_index=True) #合并所有数据表\n",
    "\n",
    "df=df[df['营养成分'].isin(cols)] #筛除非不需要的数据\n",
    "\n",
    "df=df.pivot(index='注册证号',columns='营养成分',values='每100kJ').fillna(0)\n",
    "\n",
    "df=df[cols]\n",
    "\n",
    "df=df.astype('double') #转换类型，方便后面排序\n",
    "\n",
    "df.columns=['能量(kJ)','脂肪(g)','碳水化合物(g)','蛋白质(g)','钠(mg)','氯(mg)','钾(mg)','磷(mg)'] #修改‘钠(g)‘为‘钠(mg)‘"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e04bfac5-cb0a-4241-b2cd-870f7173058b",
   "metadata": {},
   "outputs": [],
   "source": [
    "#因为钠的数据没有提取成功，所以针对钠，在做一遍提取步骤\n",
    "na_data=[]\n",
    "for i in range(len(all_text)):\n",
    "    if col[i]==2:\n",
    "        pattern = r\"钠\\(mg\\)\\s+(\\d+\\.?\\d*)\\s+(\\d+\\.?\\d*)\"\n",
    "    else:\n",
    "        pattern = r\"钠\\(mg\\)\\s+(\\d+\\.?\\d*)\\s+(\\d+\\.?\\d*)\\s+(\\d+\\.?\\d*)\"\n",
    "    matches = re.findall(pattern, all_text[i])\n",
    "    data=[]\n",
    "    for match in matches:\n",
    "        data.append([match[-1],name[i][:-4]])\n",
    "    data=pd.DataFrame(data,columns=['每100kJ','注册证号'])\n",
    "    na_data.append(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ddeacfb6-4d89-4064-921c-1ff27eba2d89",
   "metadata": {},
   "outputs": [],
   "source": [
    "na_data=pd.concat(na_data).set_index('注册证号')['每100kJ']\n",
    "na_data=na_data.astype('float')*1000 #转换钠含量的单位"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "978cb219-1e2e-48c5-a51b-ccd98ee87868",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['钠(mg)']=na_data #赋值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0f945e44-9010-43b4-b55c-64b3a5358c7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_excel('result1.xlsx') #保存数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "52144a1c-bdc2-450c-ae7a-27bb834a328d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>能量(kJ)</th>\n",
       "      <th>脂肪(g)</th>\n",
       "      <th>碳水化合物(g)</th>\n",
       "      <th>蛋白质(g)</th>\n",
       "      <th>钠(mg)</th>\n",
       "      <th>氯(mg)</th>\n",
       "      <th>钾(mg)</th>\n",
       "      <th>磷(mg)</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>注册证号</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>国食注字TY20230045</th>\n",
       "      <td>100.0</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.007</td>\n",
       "      <td>5.9</td>\n",
       "      <td>45000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国食注字TY20220002</th>\n",
       "      <td>100.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.100</td>\n",
       "      <td>5.8</td>\n",
       "      <td>80400.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国食注字TY20230062</th>\n",
       "      <td>100.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.080</td>\n",
       "      <td>5.8</td>\n",
       "      <td>24000.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                能量(kJ)  脂肪(g)  碳水化合物(g)  蛋白质(g)    钠(mg)  氯(mg)  钾(mg)  磷(mg)\n",
       "注册证号                                                                         \n",
       "国食注字TY20230045   100.0   0.04     0.007     5.9  45000.0    0.0    0.0    0.0\n",
       "国食注字TY20220002   100.0   0.00     0.100     5.8  80400.0    0.0    0.0    0.0\n",
       "国食注字TY20230062   100.0   0.00     0.080     5.8  24000.0    0.0    0.0    0.0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by='蛋白质(g)')[::-1].head(3) #排序"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65ceada7-c86c-4751-bbfe-45dd816aca57",
   "metadata": {},
   "source": [
    "# 任务1.2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2bc63722-7726-49a9-8089-168c1fcbe0a6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 提取数据\n",
    "def take_data(text):\n",
    "    #产品类别\n",
    "    start = text.find(\"【产品类别】\")\n",
    "    end = text.find(\"\\n【配料表】\")\n",
    "    category = text[start+6:end]\n",
    "    #组织状态\n",
    "    start = text.find(\"【组织状态】\")\n",
    "    end = text.find(\"\\n【适用人群】\")\n",
    "    status = text[start+6:end]\n",
    "    #使用人群\n",
    "    start = text.find(\"【适用人群】\")\n",
    "    end = text.find(\"\\n【食用方法和食用量】\")\n",
    "    suitable = text[start+6:end]\n",
    "    #合并数据\n",
    "    data=[category,status,suitable]\n",
    "    return data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "b47fdc27-9cd5-48b8-8898-1a9ce606baad",
   "metadata": {},
   "outputs": [],
   "source": [
    "folder_path=r\"C:\\Users\\柔莹\\Desktop\\泰迪杯数据分析\\B题\\数据\\特医食品说明书\"\n",
    "all_data = []\n",
    "for filename in os.listdir(folder_path):\n",
    "    if filename.endswith(\".pdf\"):\n",
    "        file_path = os.path.join(folder_path, filename)\n",
    "        text = read_pdf(file_path)\n",
    "        data=take_data(text)\n",
    "        data.append(filename[:-4])  #加上注册证号\n",
    "        all_data.append(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "376a7f24-cc55-43fe-8957-d34ef79e6ccf",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=pd.DataFrame(all_data,columns=['产品类别','组织状态','适用人群','注册证号'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7a0ad03d-520e-4641-ab42-2483dffe15af",
   "metadata": {},
   "outputs": [],
   "source": [
    "for c in df.columns:\n",
    "    df[c] = df[c].str.replace(' ', '').str.replace('\\n', '')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "78d15018-c641-4b2c-842f-2570cd4af5c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2=pd.read_excel(r\"C:\\Users\\柔莹\\Desktop\\泰迪杯数据分析\\B题\\数据\\data.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "d488a067-2a36-413b-8a4f-3944295c23e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "data=pd.merge(left=df2,right=df,on='注册证号')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "8ee007fe-42d5-4fbd-b13b-c9e3f2e96368",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_excel('result2.xlsx')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3af42b84-bb76-4443-89c1-ee0e6f6b3efe",
   "metadata": {},
   "source": [
    "# 1.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "3f9fa7b6-2f8d-4206-8d86-3a35e9781484",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['适用人群类别']='1岁以上特医食品'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "8ac8eba4-4ab8-4c81-bdae-7f939da20a2b",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.loc[data['适用人群'].str.contains('婴儿'),'适用人群类别']='特医婴配食品'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "137cfdd3-97e1-4261-8f1b-95f4fa8a4065",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_excel('result2.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "f3bd51d2-75be-4ab5-bf74-e922a5e1b777",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th>产品名称</th>\n",
       "      <th>注册证号</th>\n",
       "      <th>有效期至</th>\n",
       "      <th>产品类别</th>\n",
       "      <th>组织状态</th>\n",
       "      <th>适用人群</th>\n",
       "      <th>适用人群类别</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>SHS INTERNATIONAL LTD</td>\n",
       "      <td>纽康特特殊医学用途婴儿氨基酸配方食品</td>\n",
       "      <td>国食注字TY20175001</td>\n",
       "      <td>2027-10-13</td>\n",
       "      <td>氨基酸配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>食物蛋白过敏婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ABBOTT LABORATORIES S.A.</td>\n",
       "      <td>雅培亲护特殊医学用途婴儿乳蛋白部分水解配方粉</td>\n",
       "      <td>国食注字TY20175002</td>\n",
       "      <td>2027-10-13</td>\n",
       "      <td>乳蛋白部分水解配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄乳蛋白过敏高风险婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>ABBOTT LABORATORIES S.A.</td>\n",
       "      <td>菁挚呵护特殊医学用途婴儿乳蛋白部分水解配方粉</td>\n",
       "      <td>国食注字TY20175003</td>\n",
       "      <td>2022-11-19</td>\n",
       "      <td>乳蛋白部分水解配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0-12月龄乳蛋白过敏高风险婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>杭州贝因美母婴营养品有限公司</td>\n",
       "      <td>贝因美特殊医学用途婴儿无乳糖配方食品</td>\n",
       "      <td>国食注字TY20180001</td>\n",
       "      <td>2028-01-17</td>\n",
       "      <td>无乳糖配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄乳糖不耐受婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>SHS INTERNATIONAL LTD</td>\n",
       "      <td>纽贝瑞特殊医学用途婴儿苯丙酮尿症配方粉</td>\n",
       "      <td>国食注字TY20185001</td>\n",
       "      <td>2028-01-17</td>\n",
       "      <td>氨基酸代谢障碍配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄苯丙酮尿症婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       企业名称                    产品名称            注册证号  \\\n",
       "0     SHS INTERNATIONAL LTD      纽康特特殊医学用途婴儿氨基酸配方食品  国食注字TY20175001   \n",
       "1  ABBOTT LABORATORIES S.A.  雅培亲护特殊医学用途婴儿乳蛋白部分水解配方粉  国食注字TY20175002   \n",
       "2  ABBOTT LABORATORIES S.A.  菁挚呵护特殊医学用途婴儿乳蛋白部分水解配方粉  国食注字TY20175003   \n",
       "3            杭州贝因美母婴营养品有限公司      贝因美特殊医学用途婴儿无乳糖配方食品  国食注字TY20180001   \n",
       "4     SHS INTERNATIONAL LTD     纽贝瑞特殊医学用途婴儿苯丙酮尿症配方粉  国食注字TY20185001   \n",
       "\n",
       "        有效期至       产品类别 组织状态              适用人群  适用人群类别  \n",
       "0 2027-10-13      氨基酸配方   粉状          食物蛋白过敏婴儿  特医婴配食品  \n",
       "1 2027-10-13  乳蛋白部分水解配方   粉状  0～12月龄乳蛋白过敏高风险婴儿  特医婴配食品  \n",
       "2 2022-11-19  乳蛋白部分水解配方   粉状  0-12月龄乳蛋白过敏高风险婴儿  特医婴配食品  \n",
       "3 2028-01-17      无乳糖配方   粉状     0～12月龄乳糖不耐受婴儿  特医婴配食品  \n",
       "4 2028-01-17  氨基酸代谢障碍配方   粉状     0～12月龄苯丙酮尿症婴儿  特医婴配食品  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3359edd9-b15b-46d4-9aa9-b42f82d2a46c",
   "metadata": {},
   "source": [
    "# 1.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "6fe08a98-07d1-489c-a69f-6d3140c34b98",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['产品来源']='国产产品'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "b8dad3d5-60b5-4272-9abb-ba0fade46404",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.loc[data['注册证号'].str.get(-4)=='5','产品来源']='进口产品'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "80da1049-06ed-49ef-9eaf-e20e82001cb7",
   "metadata": {},
   "outputs": [],
   "source": [
    "data['登记年份']=data['注册证号'].str[6:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "6e88e624-d108-416e-a558-4c0d8ab8e343",
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_excel('result2.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "5ee6834e-1d84-422b-8a41-50b0dc4d46ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th>产品名称</th>\n",
       "      <th>注册证号</th>\n",
       "      <th>有效期至</th>\n",
       "      <th>产品类别</th>\n",
       "      <th>组织状态</th>\n",
       "      <th>适用人群</th>\n",
       "      <th>适用人群类别</th>\n",
       "      <th>产品来源</th>\n",
       "      <th>登记年份</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>SHS INTERNATIONAL LTD</td>\n",
       "      <td>纽康特特殊医学用途婴儿氨基酸配方食品</td>\n",
       "      <td>国食注字TY20175001</td>\n",
       "      <td>2027-10-13</td>\n",
       "      <td>氨基酸配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>食物蛋白过敏婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "      <td>进口产品</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ABBOTT LABORATORIES S.A.</td>\n",
       "      <td>雅培亲护特殊医学用途婴儿乳蛋白部分水解配方粉</td>\n",
       "      <td>国食注字TY20175002</td>\n",
       "      <td>2027-10-13</td>\n",
       "      <td>乳蛋白部分水解配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄乳蛋白过敏高风险婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "      <td>进口产品</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>ABBOTT LABORATORIES S.A.</td>\n",
       "      <td>菁挚呵护特殊医学用途婴儿乳蛋白部分水解配方粉</td>\n",
       "      <td>国食注字TY20175003</td>\n",
       "      <td>2022-11-19</td>\n",
       "      <td>乳蛋白部分水解配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0-12月龄乳蛋白过敏高风险婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "      <td>进口产品</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>杭州贝因美母婴营养品有限公司</td>\n",
       "      <td>贝因美特殊医学用途婴儿无乳糖配方食品</td>\n",
       "      <td>国食注字TY20180001</td>\n",
       "      <td>2028-01-17</td>\n",
       "      <td>无乳糖配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄乳糖不耐受婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "      <td>国产产品</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>SHS INTERNATIONAL LTD</td>\n",
       "      <td>纽贝瑞特殊医学用途婴儿苯丙酮尿症配方粉</td>\n",
       "      <td>国食注字TY20185001</td>\n",
       "      <td>2028-01-17</td>\n",
       "      <td>氨基酸代谢障碍配方</td>\n",
       "      <td>粉状</td>\n",
       "      <td>0～12月龄苯丙酮尿症婴儿</td>\n",
       "      <td>特医婴配食品</td>\n",
       "      <td>进口产品</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                       企业名称                    产品名称            注册证号  \\\n",
       "0     SHS INTERNATIONAL LTD      纽康特特殊医学用途婴儿氨基酸配方食品  国食注字TY20175001   \n",
       "1  ABBOTT LABORATORIES S.A.  雅培亲护特殊医学用途婴儿乳蛋白部分水解配方粉  国食注字TY20175002   \n",
       "2  ABBOTT LABORATORIES S.A.  菁挚呵护特殊医学用途婴儿乳蛋白部分水解配方粉  国食注字TY20175003   \n",
       "3            杭州贝因美母婴营养品有限公司      贝因美特殊医学用途婴儿无乳糖配方食品  国食注字TY20180001   \n",
       "4     SHS INTERNATIONAL LTD     纽贝瑞特殊医学用途婴儿苯丙酮尿症配方粉  国食注字TY20185001   \n",
       "\n",
       "        有效期至       产品类别 组织状态              适用人群  适用人群类别  产品来源  登记年份  \n",
       "0 2027-10-13      氨基酸配方   粉状          食物蛋白过敏婴儿  特医婴配食品  进口产品  2017  \n",
       "1 2027-10-13  乳蛋白部分水解配方   粉状  0～12月龄乳蛋白过敏高风险婴儿  特医婴配食品  进口产品  2017  \n",
       "2 2022-11-19  乳蛋白部分水解配方   粉状  0-12月龄乳蛋白过敏高风险婴儿  特医婴配食品  进口产品  2017  \n",
       "3 2028-01-17      无乳糖配方   粉状     0～12月龄乳糖不耐受婴儿  特医婴配食品  国产产品  2018  \n",
       "4 2028-01-17  氨基酸代谢障碍配方   粉状     0～12月龄苯丙酮尿症婴儿  特医婴配食品  进口产品  2018  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4f5d9a05-9432-4106-8194-96b85fb1495e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
